<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>CORS test</title>
  </head>
  <body>
    <pre id="apiData"></pre>
    <script>
      fetch('http://localhost:3030/api/v1/users')
        .then(function (response) {
          return response.json();
        })
        .then(function (data) {
          appendData(data);
        })
        .catch(function (err) {
          console.log('error: ' + err);
        });
      function appendData(data) {
        document.getElementById('apiData').innerHTML = JSON.stringify(
          data,
          null,
          '\t',
        );
      }
    </script>
  </body>
</html>
